//
// Created by liushuai on 2020/3/23.
//
#include "isValidBST.h"
int*last = nullptr;
bool isValidBST(TreeNode* root) {
    if (root){
        if(!isValidBST(root->left))
            return false;
        if (last && *last>=root->val)
            return false;
        last = &root->val;
        return isValidBST(root->right);
    }else return true;
}
